package b2.scene.fight.skills
{
	public class DurativeAreaHarm extends AreaHarm
	{
		protected var durationTime:int;
		//间隔时间
		protected var spacingInterval:int;
		
		protected var lastDruation:int;
		
		public function DurativeAreaHarm(tankId:int, tankSide:int ,level:int, skillArgs:Object)
		{
			super(tankId, tankSide ,level, skillArgs);
			spacingInterval = 1;
			durationTime = 4;
			lastDruation = 0;
		}
		
		public override function checkSkillTriggerPremise(x:int, y:int, direction:int):Boolean
		{
			if (super.checkSkillTriggerPremise(x, y, direction))
			{
				durationTime = 0;
				lastDruation = 0;
				return true;
			}
			else if (durationTime <= 4)
			{
				if (durationTime - lastDruation >= spacingInterval)
				{
					lastDruation = durationTime;
					return true;
				}
			}
			return false;
		}
		
		public override function discharge(x:int, y:int, direction:int):void
		{
			super.discharge(x, y, direction);
			coolDown = skillArgs.cooldown;
		}
		
		public override function onTimer():void
		{
			durationTime ++;
			super.onTimer();
		}
	}
}